Folders Collection Object

The Folders collection object contains one or more Folder objects.

Quick Info

Specified in header file:

MDISP.ODL

First available in version:

OLE Messaging Library 1.0

Parent objects:

Folder (Inbox or Outbox)

Child objects:

FolderKM47H0

Default property:

Item109DJ4L

 

A Folders collection is considered a large collection, which means that the Count and Item properties have limited validity, and your best option is to use a Folder object identifier value or the Get methods to access an individual Folder object within the collection.

Properties

 
Property name

Available in version

 
Type

 
Access

Application5GI0QO

1.0

String

Read-only

Class1CT5_O0

1.0

Long

Read-only

CountNIXFF_

1.1

Long

Read-only

 

 

 

 

Item109DJ4L

1.1

Folder object

Read-only

Parent13HN1VR

1.0

Inbox or Outbox folder object

Read-only

Session23X3PG

1.0

Session object

Read-only

 

Methods

 
Method name

Available in version

 
Parameters

Add75XRZ

1.1

name as String

Delete11O.JAV

1.1

(none)

GetFirst2M91_LL

1.0

(none)

GetLast31_T_53

1.0

(none)

GetNextL476GW

1.0

(none)

GetPreviousICJPU4

1.0

(none)

 

 

 

 

Remarks

Large collections, such as the Folders collection, cannot always maintain an accurate count of the number of objects in the collection. It is strongly recommended that you use the GetFirst2M91_LL, GetNextL476GW, GetLast31_T_53, and GetPreviousICJPU4 methods to access individual items in the collection. You can also access a specific folder by using the Session object s GetFolder67IU1J method.

Example

To refer to a unique Folder object within the Folders collection, use the collection s GetFirst and GetNext methods or use the FolderID value as the index.

The following code sample demonstrates the Get methods. The sample assumes that you have three subfolders within your Inbox and three subfolders within your Outbox. After this code runs, the three folders in the Inbox are named Blue, Red, and Orange (in that order), and the three folders in the Outbox are named Gold, Purple, and Yellow (in that order).

Dim objSession As Object

Dim objMessage As Object

Dim objFolder As Object

 

Set objSession = CreateObject("MAPI.Session")

objSession.Logon "User", "", True

With objSession.Inbox.Folders

   Set objFolder = .GetFirst

   objFolder.Name = "Blue"

   Set objFolder = .GetNext

   objFolder.Name = "Red"

   Set objFolder = .GetLast

   objFolder.Name = "Orange"

End With

With objSession.Outbox.Folders

   Set objFolder = .GetFirst

   objFolder.Name = "Gold"

   Set objFolder = .GetNext

   objFolder.Name = "Purple"

   Set objFolder = .GetLast

   objFolder.Name = "Yellow"

End With

objSession.Logoff

 

See Also

Object CollectionsH0P41I